package GameCode;

import java.util.ArrayList;

public class ConcreteAllyControlCenter extends AllyControlCenter{
    private String allyName;
    protected ArrayList<Obeserver> players;

    public ConcreteAllyControlCenter(String allyName) {
        this.allyName = allyName;
        players=new ArrayList<Obeserver>();
    }

    @Override
    public void join(Obeserver obs) {
        players.add(obs);
    }

    @Override
    public void quit(Obeserver obs) {
        players.remove(obs);
    }

    @Override
    public void notifyObserver(String name) {
        for(Object obs:players)
            if(!((Obeserver)obs).getName().equalsIgnoreCase(name)){
                ((Obeserver)obs).help();
            }
    }
}
